if (Drupal.jsEnabled) {	
	
	$(document).ready(function () {
		
		$('a.group_link').click(function () {
			var breadcrumb = '';
			var first = true;
			
			$(this).parents('li').each(function() {
				if (!first) {
					breadcrumb = '<a class="groups_breadcrumb" nodeid="0" href="'+$('a:first[nodeid]',this).attr('href')+'">'+$('a:first[nodeid]',this).html()+'</a>'+';' + breadcrumb;
					
				} else {
				  first = false;
				}
				
			});
			breadcrumb += '<a href="'+$(this).attr('href')+'">'+$(this).html()+'</a>';
			$.ajax({
				type: 'POST', 
				url: Drupal.settings.basePath+'groups_catalog/breadcrumb',
				dataType: 'json',
				data: 'breadcrumb='+breadcrumb,
				async:false,
			});			

		});
		
		$('a.groups_breadcrumb').click(function () {
      var breadcrumb = '';
      
      $(this).prevAll('a.groups_breadcrumb').each(function() {
         breadcrumb = '<a class="groups_breadcrumb" nodeid="0" href="'+$(this).attr('href')+'">'+$(this).html()+'</a>'+';' + breadcrumb;
        
      });
      breadcrumb += '<a href="'+$(this).attr('href')+'">'+$(this).html()+'</a>';
      $.ajax({
        type: 'POST', 
        url: Drupal.settings.basePath+'groups_catalog/breadcrumb',
        dataType: 'json',
        data: 'breadcrumb='+breadcrumb,
        async:false,
      });     

    });
	});
}